RWTH - Mindstorms NXT Toolbox

OpenLight

Sets the parameter mode of the NXT light sensor

Contents

Syntax

OpenLight(port, mode)

OpenLight(port, mode, handle)

Description

OpenLight(port, mode) initializes the input mode of NXT light sensor specified by the sensor port and the light mode. The value port can be addressed by the symbolic constants SENSOR_1 , SENSOR_2, SENSOR_3 and SENSOR_4 analog to the labeling on the NXT Brick. The mode represents one of two modes 'ACTIVE' (active illumination: red light on) and 'INACTIVE' (passive illumination red light off). To deactive the active illumination the function CloseSensor is used.

The last optional argument can be a valid NXT handle. If none is specified, the default handle will be used (call COM_SetDefaultNXT to set one).

For more complex settings the function NXT_SetInputMode can be used.

Example

   OpenLight(SENSOR_1, 'ACTIVE');
   light = GetLight(SENSOR_1);
   CloseSensor(SENSOR_1);

See also

NXT_SetInputMode, CloseSensor, GetLight, SENSOR_1, SENSOR_2, SENSOR_3, SENSOR_4

Signature